validate_apply_transfer
function validate_apply_transfer(init_transfer_tx: gtx_transaction, init_tx_op_index: integer, previous_hop_tx: gtx_transaction, op_index: integer, hop_index: integer): ((tx_rid: byte_array, args: immutable_mirror_struct<init_transfer>, sender_account_id: byte_array), byte_array)Validates that the parameters are correct for an apply_transfer operation. Also used in
other operations that require the same validation to occur (e.g. cancel_transfer)
It does not verify whether the transfer expired.
Among other things, this function validates that:
- Transfer was not already applied on this chain
- Transfer was not already canceled on this chain
- Transfer was not already unapplied on this chain
- That the
init_transferdetails are correct - The
iccf_proofthat states that this transfer was applied on the previous hop
Throws "INVALID TRANSACTION" if the transfer has already been applied, canceled or
unapplied on this chain.
Throws "INPUT ERROR" if the input is malformed. Common scenarios include:
- arguments found in
init_transfer_txandprevious_hop_txdo not match hop_indexis out of boundsprevious_hop_txhas not been sent to the chain that comes before this one on the transfer hops
Throws "WRONG BLOCKCHAIN" if the chain at hop_index on the init transaction is not this
chain
Throws if the op_index does not point to apply_transfer
Throws if the init_tx_op_index does not point to init_transfer on its init_transfer_tx
Throws if the operation preceding init_transfer is not an auth operation
Throws if the transaction is missing the iccf_proof operation, which demonstrates that
the block containing the previous_hop_tx has been anchored from the previous chain.
Parameters
- init_transfer_tx — the init transaction, which contains
init_transfer, as it was submitted to the starting chain - init_tx_op_index — the index of the
init_transferoperation ininit_transfer_tx - previous_hop_tx — the transaction that applied the transfer in the chain that comes before this one. Same as
init_transfer_txif this is the first chain where the transfer is applied. - op_index — the index of the
apply_transferoperation inprevious_hop_tx - hop_index — which index in the hops array provided in the original transaction this chain represents.
See Also
- [core.auth.is_auth_op] — for information on auth operations